<?php
/**
 * @link https://www.leadshop.vip/
 * @copyright Copyright ©2020-2021 浙江禾成云计算有限公司
 */

namespace store\app;

use app\components\ComPromoter;
use coupon\models\Coupon;
use framework\common\BasicController;
use store\models\Store;
use Yii;
use \framework\common\TokenHttpException;

/**
 * 后台用户管理器
 */
class IndexController extends BasicController
{

    public function actions()
    {
        $actions = parent::actions();
        unset($actions['create']);
        unset($actions['update']);
        return $actions;
    }

    public function actionIndex()
    {
        $where['deleted']=0;
        $data =  Store::find()
            ->where($where)
            ->orderBy(['created_time' => SORT_DESC])
            ->asArray()
            ->all();
        $new_data = [];
        foreach ($data as $key => $value) {
            $new_data[$key]['store_name'] = str2url($value['store_name']);
            $new_data[$key]['id'] = str2url($value['id']);
            $new_data[$key]['work_start_time'] = str2url($value['work_start_time']);
            $new_data[$key]['work_end_time'] = str2url($value['work_end_time']);
            //$new_data[$key]['work_time'] = str2url($value['work_start_time'])."~".str2url($value['work_end_time']);
//            $step = 1800;//步长
//            $stime = strtotime($value['work_start_time']);//开始时间
//            $etime = strtotime($value['work_end_time']);//结束时间
//            $date_array = [];
//            $date_array2 = [];
//            $i=0;
//            while($stime < $etime){
//                if($i!=0) {
//                    $stime += $step;
//                }
//                $date_array[] = date("H:i",$stime);
//                $date_array2[] = date("H:i",$stime);
//                $i++;
//            }
//            $date_array3 = [];
//            foreach ($date_array2 as $kbe=>$veb) {
//                if(($kbe!=0) && ($kbe!=1) ) {
//                    $date_array3[] = $veb;
//                }
//            }
//            $new_data[$key]['date_array'] = $date_array;
//            $new_data[$key]['date_array2'] = (array)$date_array3;
        }
        return $new_data;
    }


}
